<?php
include_once('admin-load.php');
	$shipment_id = isset($_REQUEST['shipment_id'])?$_REQUEST['shipment_id']:null;
        $shipment='';
     if ($shipment_id) {
            
            $shipment = $dbna->get_row("SELECT * FROM shipment_detail WHERE id = $shipment_id ");
            $ch1 = $ch2 = $ch3 = '';
            switch ($shipment->payment_type) {
                case 1:
                    $ch1 = 'checked="checked"';
                    break;
                case 3:
                    $ch3 = 'checked="checked"';
                    break;
                case 2:
                default:
                    $ch3 = 'checked="checked"';
                    break;
            }
            
     }

   if (isset($_POST['submit_form'])) {
        update_shipment_detail();
    }
?> 
<?php
	include_once 'header.php';
?>
            <div id="main_content">
                <div id="content">
                    
				</div>
					<div class="container">
            <h5>Update shipment_detail</h5>

					</div>
				<div id="main">
                    <h2>Create New shipment_detail edit</h2>
                    <form id="add_user" action="shipment-detail-edit.php" method="post">
                        <input type="hidden" value="1" name="submit_form"/>
                        <input type="hidden" value="<?php echo $shipment_id ?>" name="shipment_id" />
                        <fieldset>
                            <legend>Form Add  shipment_detail-add new edit</legend>
                        <div>
                            <label for="origin">Origin <span></span></label>
                            <input type="text" id="origin" name="origin" value="<?php echo $shipment->origin  ?>"/>
                        </div>
                        <div>
                            <label for="weight">Weight <span></span></label>
                            <input type="text" id="weight" name="weight"value="<?php echo $shipment->weight ?>"/>
                        </div>
                        <div>
                            <label for="price">Price <span></span></label>
                            <input type="text" id="price" name="price"value="<?php echo $shipment->price ?>"/>
                        </div>
                        <div>
                            <label for="description">Description <span></span></label>
                            <input type="text" id="description" name="description"value="<?php echo $shipment->	decription ?>"/>
                        </div>
                        <div>
                            <label for="pieces">Pieces</label>
                            <input type="text" id="pieces" name="pieces"value="<?php echo $shipment->pieces ?>"/>
                        </div>
                        
                            <div>
                                <label for="payment">Payment</label>
                                    <input type="text" id="payment" name="payment"value="<?php echo $shipment->payment ?>"/>
                            </div>
                         <div>
                            <label for="payment">Payment type</label>
                            <div class="Payment_type">
                                <input type="radio" name="payment_type" <?php echo $ch1 ?> value="1"/>A/C
                                <input type="radio" name="payment_type" <?php echo $ch2 ?> value="2"/>Case
                                <input type="radio" name="payment_type" <?php echo $ch3 ?> value="3"/>Collect
                            </div>
                            <div>
                                <input type="submit" value="Update" name="submit"/>
                            </div>
                        </div>
                              
                        </div>
                    </form>
                </div>
            </div>
<?php 
	include_once 'footer.php';
?>